package com.itic.web.question.questionmodel.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.itic.appbase.framework.common.controller.BaseController;
import com.itic.appbase.framework.plugins.mybatis.Page;
import com.itic.ht.cms.examrecord.persistence.model.ExamQuestion;
import com.itic.ht.cms.examrecord.persistence.model.ExamRecord;
import com.itic.web.qo.TokenData;
import com.itic.web.question.questionmodel.service.AppQuestionService;
import com.itic.web.ro.ResResult;



@Controller
@RequestMapping(value="/app/exam")
public class AppQuestionController extends BaseController {

	
    @Autowired
    private AppQuestionService questionService;
    
    /**
     * 取得问题类型列表
     * @param token
     * @return
     */
    @RequestMapping(value = "/getQuestionTypeList")
    @ResponseBody
    public ResResult getTypeList(TokenData data){
    	return questionService.getTypeList(data);
    }
    
    /**
     * 取得学习信息
     * @param token
     * @return
     */
    @RequestMapping(value = "/getStudyInfo")
    @ResponseBody
    public ResResult getStudyInfo(TokenData data,String CategoryId){
    	return questionService.getStudyInfo(data,CategoryId);
    }
    
    /**
     * 取得考试试卷
     * 
     * @param token
     * @return
     */
    @RequestMapping(value = "/getExamModel")
    @ResponseBody
    public ResResult getExamModel(TokenData data,String CategoryId,String isRandom){
    	ResResult result = questionService.getExamModel(data,CategoryId,isRandom);
    	return result;
    }
    
    


    /**
     * 根据 考卷号 和 试题号 和 结果      =============  添加考试流水
     * 可以试行在考试时不提供结果，后台验证结果 如成功则返回成功，如失败则返回提示
     * 注意在最后一次数据提交后 ======总结这次考试结果 并生成考试记录
     * @param token
     * @return
     */
    @RequestMapping(value = "/addExamWater")
    @ResponseBody
    public ResResult addExamWater(TokenData data,ExamQuestion examQuestion){
    	return questionService.addExamWater(data,examQuestion);
    }
    
    /**
     * 注意在最后一次数据提交后 ======总结这次考试结果 并生成考试记录
     * @param token
     * @return
     */
    @RequestMapping(value = "/getExamResult")
    @ResponseBody
    public ResResult getExamResult(TokenData data,ExamRecord templet){
    	return questionService.getExamResult(data,templet);
    }
    
    
}